#include "ct.h"

namespace kuai {

	ConnectionTable::ConnectionTable(AtomIndex ct[]) {
		ItemSize nAtoms = ct[0], nBonds = ct[1];
		Index* pBonds = ct+2;
		Index* pAtoms = pBonds + 2 * nBonds;
		Index* pAdjs = pAtoms + 2 * nAtoms;
		for (Index* p = pBonds; p != pAtoms;) {
			AtomIndex a1 = *p++;
			AtomIndex a2 = *p++;
			pAtoms[a1*2]++;
			pAtoms[a2*2]++;
		}
	};

	ItemSize ConnectionTable::countConnectionTableSize(ItemSize nAtoms, ItemSize nBonds) {
		ItemSize result = 2; // 0 and 1 is nAtoms and nBonds;
		result += 2 * nBonds; // then followed by a sequence of atoms of bonds.
		result += 2 * nAtoms;
	};


}
